<div class="titlebar button-group">
    <div class="fn-left">优惠券</div>
    <div class="fn-right">
        <form id="form" action="{:url('coupon.index/index')}" class="input-group">
            <input type="hidden" id="store_id" name="store_id" value="{$store_id}"/>
            <input type="hidden" name="types" value="{$types}"/>
            <input placeholder="开始时间" class="input w100 ui-date" type="text" name="starttime" readonly autocomplete="false" value="{$starttime}"/>
            <input placeholder="结束时间" class="input w100 ui-date" type="text" name="endtime" readonly autocomplete="false" value="{$endtime}"/>
            <input url="{:url('store.index/selectStore')}" id="selectStore" readonly="true" placeholder="好店名称" class="input readonly chickWin" type="text" name="store_name"  value="{$store_name}" readonly/>
            <input placeholder="请输入优惠券名称" class="input" type="text" name="keyword" value="{$keyword}"/>
            <input type="submit" value="搜索" class="button button-blue" />
        </form>
    </div>
    <div class="fn-right">
        <a href="{:url('coupon.index/index',['time' => 1,'types'=>0])}" class="button {$time==1?'button-violet':''}">今日</a>
        <a href="{:url('coupon.index/index',['time' => 2,'types'=>0])}" class="button {$time==2?'button-violet':''}">昨日</a>
        <a href="{:url('coupon.index/index',['time' => 30,'types'=>0])}" class="button {$time==30?'button-violet':''}"">本月</a>
        <a href="{:url('coupon.index/index',['time' => 60,'types'=>0])}" class="button {$time==60?'button-violet':''}"">上月</a>
    </div>
</div>
<div class="titlebar">
    <div class="fn-left">
        <sapan class="button button-blue chickWin" url="{:url('coupon.index/edit')}"> <i class="iconfont icon-add_icon"></i>增加优惠券</sapan>
    </div>
    <div class="fn-right button-group">
        <a href="{:url('coupon.index/index',['types'=>1,'time' => $time,'starttime' => $starttime,'endtime' => $endtime])}" class="button{if $types == 1} button-green{/if}">禁领取</a>
        <a href="{:url('coupon.index/index',['types'=>2,'time' => $time,'starttime' => $starttime,'endtime' => $endtime])}" class="button{if $types == 2} button-yellow{/if}">回收站</a>
    </div>
</div>
<table class="table table-border">
    <thead>
        <tr>
            <th class="w60 fn-tac">排序</th>
            <th>优惠券信息</th>
            <th class="w100 fn-tar">发现数量</th>
            <th class="w100 fn-tar">满用(￥)</th>
            <th class="w100 fn-tac">类型</th>
            <th class="w100 fn-tar">优惠</th>
            <th class="w120 fn-tac">更新日期</th>
            <th class="w120 fn-tac">状态</th>
            <th class="w150 fn-tac">操作</th>
        </tr>
    </thead>
    <tbody>
        {foreach $lists as $vo}
        <tr>
            <td class="fn-tac"><input name="sort" class="fn-tac w40 input input-mini sort" type="text" value="{$vo['sort']}" id="{$vo.id}" /></td>
            <td>
                <p class="chickWin fn-cp" url="{:url('coupon.index/review',['id'=>$vo.id])}">
                    <i class="iconfont icon-discount"></i><span class="fn-fb">{$vo.name}</span><br />
                    <span class="gray"><i class="iconfont icon-wodedingdan2"></i>{$vo.tips}</span>
                </p>
            </td>            
            <td class="fn-tar">{$vo.num}</td>
            <td class="fn-tar">￥{$vo.howmuch|money}</td>
            <td class="fn-tac"><span class="badge {switch $vo.types}{case 1}bg-green{/case}{case 2}{/case}{case 3}bg-red{/case}{default /}bg-blue{/switch}">{$vo.typesname}</span></td>
            <td class="fn-tar">{$vo.degree}</td>
            <td class="fn-tac">{$vo.update_time|date="Y-m-d"}</td>
            <td class="fn-tac">
                {if $vo.is_end}
                    <span class="fn-cp badge" title="过期/领完">失效</span>
                {else}
                    <span class="fn-cp istop badge {$vo.is_lock?'bg-red':''}" url="{:url('coupon.index/islock',['id'=>$vo.id])}">{$vo.is_lock?'禁领取':'禁领取'}</span>
                    <span class="fn-cp istop badge {$vo.is_top?'bg-green':''}" url="{:url('coupon.index/istop',['id'=>$vo.id])}">{$vo.is_top?'推荐':'推荐'}</span>
                {/if}
            </td>
            <td class="button-group">
                {if $vo.types == 3}
                <a class="button button-mini button-disabled" href="javascript:;"><i class="iconfont icon-edit"></i>编辑</a>
                <a class="button button-mini button-disabled" href="javascript:;"><i class="iconfont icon-lajixiang"></i>删除</a>
                {else}
                <a class="button button-mini chickWin" url="{:url('coupon.index/edit',['id'=>$vo.id])}" href="javascript:;"><i class="iconfont icon-edit"></i>编辑</a>
                <a class="button button-mini isDel" url="{:url('coupon.index/delete',['id'=>$vo.id])}" href="javascript:;" title="删除"><i class="iconfont icon-lajixiang"></i>删除</a>
                {/if}
            </td>
        </tr>
        {/foreach}
    </tbody>
</table>
{$lists|raw}
<script type="text/javascript">
Do('base','form','layer','date', function () {
    $('#form').isForm({types:1});
    $('.isDel').isDel();
    $('.sort').changeUrl({
        url:"{:url('coupon.index/sort')}"
    });
    $('.istop').actUrl();
    $(".chickWin").win({reload:1});
})
function setState(store){
    $("#store_id").val(store.id);
    $("#selectStore").val(store.store_name);
}
</script>